﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity.ModelConfiguration;
using CarErp.Model;

namespace CarErp.Data.Mappings
{
	public class CarPurchaseApplicationMapping : EntityTypeConfiguration<CarPurchaseApplication>
	{
		public CarPurchaseApplicationMapping()
		{
			this.Id(x => x.Id);
			this.Text(x => x.ApplicantCompany, 80);
			Property(x => x.ApplicantTime).IsRequired();
			this.Text(x => x.CarName, 40);
			this.Text(x => x.Brand, 40);
			this.Text(x => x.Specification, 40);
			this.Text(x => x.ModelNumber, 40);
			this.Text(x => x.Maker, 80);
			Property(x => x.Quantity).IsRequired();
			Property(x => x.PlannedAcquisitionDate).IsRequired();
			Property(x => x.BudgetUnitPrice).HasPrecision(14, 2);
			this.Text(x => x.Appendix, 400);
			this.Text(x => x.SourceOfFunds, 40);
			Property(x => x.PropertyRight).IsRequired();

			HasRequired(x => x.Submitter)
				.WithMany()
				.WillCascadeOnDelete();
		}
	}
}